import { http } from '@/common/service/service.js' 
import configService from '@/common/service/config.service.js';
const apiService = {
	 // 验证手机号是否注册
	 register(params){
		 return http.get("/v1/checkphoneisreg",params)
	 },
	 /**
	  * 手机号验证登陆
	  */
	login(params) {
		return http.get('/code/sms',params)	
	},
	// 验证码登陆
	yzmlogin(params){
		return http.get('/login')
	},
	/**
	  * 退出
	  */
	logout(params) {
		return http.post('/sys/logout',params);
	},
	/**
	 * 获取用户信息
	 * https://universal.kwbkqi.top/user/v1/getcurruser
	 */
	getcurruser(params) {
		return http.get('/v1/getcurruser');
	},
	/**
	 * 获取文件访问路径
	 * @param avatar
	 * @param subStr
	 * @returns {*}
	 */
	getFileAccessHttpUrl(avatar,subStr){
	    if(!subStr) subStr = 'http'
	    if(avatar && avatar.startsWith(subStr)){
	        return avatar;
	    }else{
	        return configService.staticDomainURL + "/" + avatar;
	    }
	}
};

export default apiService;
